print(" () {} [] <> ")
s = input ()
sl = ''


for char in s :
    if char == '( ':
        sl += char 
        
    if char == ')':
        if len (sl)>0:
            if sl[len(sl)-1] == '(':
               sl=sl[:-1]
               
    if char =='[':
         sl += char
         
    if char == ']':
        if len (sl)>0:
            if sl[len (sl)-1] == '[':
                sl = sl[:-1]
    if char == '(':
        sl += char 
        
    if char == ')':
        if len (sl)>0:
            if sl[len(sl)-1] == '[':
                sl = sl [:-1]
                    if char == "<":
                        sl += char
             
        if char == ">":
            if len (sl)>0:
                if sl[len(sl)-1] == "<":
                    sl = sl [:-1]
    print(sl)            
         
            
